﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NestedGridView
{
    public class CustomerRepository
    {

        public List<Customer> GetCustomers(int pageId = 1, int  pageSize = 10)
        {
            var db = new NWEntities();
            var customers = db.Customers
                            .OrderBy(x => x.CustomerID)
                            .Skip((pageId - 1) * pageSize)
                            .Take(pageSize)
                            .ToList();
            return customers;
        }

        public List<Order> GetCustomerOrders(string customerId)
        {
            var db = new NWEntities();
            var orders = db.Orders
                        .Where(x => x.CustomerID == customerId)
                        .ToList();
            return orders;
        }
    }
}